import React, { Component } from "react";

export default class RefCom extends Component {
  //声明单击事件的回调
  show = () => {
    // console.log(this.refs);
    //获取 input 元素的值
    let v = this.refs.input.value;
    //设置 div 的文本
    this.refs.result.innerHTML = v;
  }

  render() {
    return (
      <div>
        <input type="text" ref="input" />
        <button onClick={this.show}>发送</button>
        <hr />
        <div
          style={{ width: 400, height: 300, border: "solid 1px #234" }}
          ref="result"
        ></div>
      </div>
    );
  }
}
